<template>
  <CartHeader :userWasLogin="userInfo ? true : false" />
  <CartContent />
  <Recommend />
</template>

<script setup lang="ts">
  import CartHeader from "./CartHeader.vue";
  import CartContent from "./CartContent.vue";
  import Recommend from "./Recommend.vue";
  import { onMounted } from "vue";
  import { useRouter } from "vue-router";

  const userInfo = localStorage.getItem("userInfo");
  const router = useRouter();

  onMounted(() => {
    if (!userInfo) {
      router.push("/auth?type=login");
    }
  });
</script>
